﻿@using DualControl.Web.Models.Common.Modals
@using DualControl.CommonServices
@model DualControl.HazardSources.Dtos.HazardSourceEditDto


@inject ICommonService CommonService

@{
    Layout = null;
}
@Html.Partial("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel("编辑风险因素信息"))

<div class="modal-body">

    <form name="RiskFactorEditForm" role="form" novalidate class="form-validation">
        <input type="hidden" name="Id" value="@Model.Id"/>
        <ul class="nav nav-tabs tab-nav-right" role="tablist">
            <li role="presentation" class="active"><a href="#riskpoint-details" data-toggle="tab">基本信息</a></li>
            <li role="presentation"><a href="#edit-accident-roles" data-toggle="tab">风险点诱发事故类型</a></li>
        </ul>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane animated fadeIn active" id="riskpoint-details">

                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">危害因素</label>
                            <textarea class="form-control" type="text" id="RiskFactor" name="RiskFactor" required minlength="3" placeholder="请输入危害因素">@Model.RiskFactor</textarea>
                        </div>
                    </div>


                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <label class="form-label">岗位</label>
                            @Html.DropDownList("PostId",CommonService.GetPosts().Select(c =>
     new SelectListItem() { Text = c.Value.ToString(), Value = c.Key.ToString() }), "==请选择岗位==", new { @class = "form-control" })
                        </div>
                    </div>
                </div>

            </div>

            <div role="tabpanel" class="tab-pane animated fadeIn" id="edit-accident-roles">
                <div class="row">
                    <div class="col-sm-12 ">
                        @foreach (var accident in CommonService.AccidentTypes())
                        {
                            <div class="col-sm-6">
                                @if (Model.AccidentTypes !=null && Model.AccidentTypes.Contains(accident.Key.ToString()))
                                    {

                                        <input type="checkbox" name="accidentlist" value="@accident.Key" title="@accident.Value" class="filled-in" checked="checked" id="role-@accident.Key" />
                                        @accident.Value
                                    }
                                    else
                                    {
                                        <input type="checkbox" name="accidentlist" value="@accident.Key" title="@accident.Value" class="filled-in" id="role-@accident.Key" />
                                        @accident.Value
                                    }

                                @*<input type="checkbox" name="accidentlist" value="@accident.Key" title="@accident.Value" class="filled-in" id="role-@accident.Key" />
                                @accident.Value*@

                            </div>
                        }
                    </div>
                </div>
            </div>

        </div>
    </form>
</div>

@Html.Partial("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")

<script src="~/view-resources/Views/RiskFactors/_EditRiskFactorModal.js" asp-append-version="true"></script>
